home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / asm_subr.arc / RCHAR < prev    next >
Encoding:
Text File  |  1986-01-20  |  3.1 KB  |  127 lines

  1. ;-------------------------rchar routine begins--------------------------+
  2. ; NAME  RCHAR
  3. ;
  4. ; ROUTINE TO PLOT A RASTER CHARACTER 
  5. ;
  6. ; from BLUEBOOK OF ASSEMBLY ROUTINES FOR IBM PC & XT.
  7. ;         page : 151
  8. ;
  9. ; FUNCTION: This routine plots a raster character.  It uses a raster
  10. ; character table in the IBM ROM BIOS. Only ASCII codes 0 - 127 are
  11. ; supported/
  12. ;
  13. ; INPUT:  Upon entry:
  14. ;
  15. ;    ACSII code character is in AL
  16. ;    x-coordinate of upper left corner of character cell is in x0
  17. ;    y-coordinate of upper left corner of character cell is in y0
  18. ;    horizontal magnitude is in xmagn
  19. ;    vertical magnitude is in ymagn
  20. ;    color of character is in color
  21. ;
  22. ; OUTPUT:  Just to the screen.
  23. ;
  24. ; REGISTERS USED: No registers are modified.
  25. ;
  26. ; SEGMENTS REFERENCED:  Upon entry ES must point to the video RAM at
  27. ; B8000h and DS must point to the data segment used by the box-fill 
  28. ; routine.
  29. ;
  30. ; ROUTINES CALLED:  SETBOX
  31. ;
  32. ; SPECIAL NOTES: No bounds checking is performed.  Unpredictable results
  33. ; will be displayed if the horizontal or vertical magnitude is too large.
  34. ; A string of raster characters can be displayed using the GMESSOUT
  35. ; routine available on this disk.
  36. ;
  37. ; ROUTINE TO PLOT A RASTER CHARACTER
  38. ;
  39. rchar    proc    far
  40. ;
  41.     push    si        ; save registers
  42.     push    dx
  43.     push    cx
  44.     push    ax
  45. ;
  46. ; look up pattern for character
  47. ;
  48.     cbw            ; convert from byte to word
  49.     sal    ax,1        ; times 2
  50.     sal    ax,1        ; times 4
  51.     sal    ax,1        ; times 8
  52.     add    ax,0FA6Eh+7    ; char table plus pattern end
  53.     mov    si,ax        ; here is the offset
  54. ;
  55.     mov    dx,ds        ; save old DS
  56.     mov    ax,0F000h    ; point DS to ROM segment
  57.     mov    ds,ax        ; load new data segment
  58. ;
  59. ; store pattern on the stack
  60.     mov    cx,8        ; for a count of eight bytes
  61.     std            ; backward direction
  62. ;
  63. rchar1:
  64.     lodsb            ; load
  65.     push    ax        ; push onto stack
  66.     loop    rchar1
  67. ;
  68.     mov    ds,dx        ; restore orig data segment
  69. ;
  70. ; get the starting point
  71.     mov    ax,x0        ; get x-coord
  72.     mov    x1,ax
  73.     mov    ax,y0        ; get y-coord
  74.     mov    y1,ax
  75. ;
  76.     mov    cx,8        ; for a count of 8 rows
  77. ;
  78. rchar2:
  79.     pop    dx        ; get the next row
  80.     push    cx        ; save the count
  81. ;
  82.     mov    al,ymagn    ; vertical sizing
  83.     cbw
  84.     dec    ax        ; one less
  85.     add    ax,y1        ; add to new dot position
  86.     mov    y2,ax
  87. ;
  88.     mov    cx,8        ; for a count of 8 dots
  89. ;
  90. rchar3:
  91.     push    cx        ; save count
  92. ;
  93.     mov    al,xmagn    ; horiz sizing
  94.     cbw
  95.     dec    ax        ; one less
  96.     add    ax,x1        ; add to new dot position
  97.     mov    x2,ax
  98. ;
  99.     test    al,80h        ; check the dot
  100.     jz    rchar4        ; skip it if zero
  101.     call    setbox        ; plot it if one
  102. ;
  103. rchar4:
  104.     mov    ax,x2        ; next column
  105.     inc    ax        ; one over from end of box
  106.     mov    x1,ax        ; into next dot posn
  107.     rol    dl,1        ; next dot from pattern
  108.     pop    cx        ; restore dot count
  109.     loop    rchar3        ; loop for next dot
  110. ;
  111.     mov    ax,x0        ; restore to first column
  112.     mov    x1,ax        ; beginning of row
  113.     mov    ax,y2        ; next row
  114.     inc    ax        ; one down from end of box
  115.     mov    y1,ax        ; into next row posn
  116.     pop    cx        ; restore row count
  117.     loop    rchar2        ; loop for next row
  118. ;
  119.     pop    ax        ; restore registers
  120.     pop    cx
  121.     pop    dx
  122.     pop    si
  123. ;
  124.     ret            ; return
  125. rchar    endp
  126. ;-------------------------rchar routine ends---------------------------+
  127.